public class Solution {
    //将两个有序链表合并为一个新的有序链表并返回
    public ListNode mergeTwoLists(ListNode list1, ListNode list2) {
        ListNode vim = new ListNode(0);
        ListNode A = list1;
        ListNode B = list2;
        ListNode cur = vim;
        while (A != null && B != null) {
            if (A.val <= B.val) {
                cur.next = A;
                cur = cur.next;
                A = A.next;
            } else {
                cur.next = B;
                cur = cur.next;
                B = B.next;
            }
        }
        if (A == null) {
            cur.next = B;
        } else if (B == null) {
            cur.next = A;
        }
        return vim.next;
    }
    //以给定值x为基准将链表分割成两部分
    
}
